jtong - refactor, make code less