Refactoring, removed unnecessary stuff, removed warnings