moving most of the profile functionalty into a module