updated some init functions into constructor for a clean API