Fixed a bug where the next button would loop through textfields

Fixed a bug where the next button would loop through textfields if they had the same y position, but inside different subviews.
De-complicated some functions.
Made some formatting consistent.