Cleanup, including seperation into Util module