Refactored and renamed

Fixed some style issues too