Fixed naming and some refactoring