Port scanner additional features

Hi guys,
I was developing a port scanner script in ruby. I found some handy
scripts online and combined them to make a pretty basic port scanner.
However i want to add more features now such as 1)Identify hostname of
ip 2)identify OS of given ip 3)Stealth scans
I found very little documentation and no scripts on the above.

Could someone point me out to some documentation, scripts, tutorials
where i could find the above.
Thanks