cleaned up code and added build variable