building bug fixed, plus code clean up