agile: separate into better functions and improve formatting