renamed and moved helpers, added tests and integrated comments