cleaning up boilerplate code - thanks @matttproud