working on code re-construction