added some helper functions

added some helper functions to handle conversions between different datatypes