smarter functions
Merge pull request #97 from dildick/master

smarter functions