Move logic out of handlers, yay!