Added better arrow functionality and cleaned up code somewhat