split up code into cleaner functions.