Made it (sort of) functional