Everything working
Some refactoring
Final refactoring