Restructured code into classes and staticmethods, added testing