added proper handling of different input types

added utils module for utility functions