fixed consistency in style and cleaned up code