Refactored a couple of small things, removed unneeded functions