separating code into lots of functions for final software implementation