refactor, add documentation, consistency and shit