cleaned up duplicate code and off spacing