little bit cleaned up code