Refactor and cleaning
Big refactor