Refactoring work and some dev