added pragmas and rearranged methods