cleaned up code and prepping for sub