Refactored methods and added pragma marks