moving some functions to utils
fixing bug in gen-powers
some docustrings added