Updates and refactoring, read comment