cleaned code, added pragma marks