Working basic funcionality, massive refactoring inc