Refactor to be slightly more pythonic & magical