First commit. Problems are resolved but there is some refactoring that needs to be done