Refactoring

Building towards stable base