CLeaning up the code some