Started putting together the final code