Some refactors, organizing code, work on gui