Cleaned and big refactor. Much more simplified