Refactored copy-and-pasted code. lol

"Refactoring" before first official version, lol bad