finished cleaning up code and it runs beautifully