Fixed some gui weirdness, and made some code more uniform