Split up functionality into 2 functions