Added conditional compilation and clened up code a bit