Cleaning up syntax and incorporating pagination and form builders into code