Removed a lot of unnecessary code