smarter functions
Merge pull request #96 from dildick/master

smarter functions