Slight refactor of handlers to get rid of sporadic timeout errors