General cleanup of code. Cleaner structure

No more duplicate code. Happy now @Barvin ? :3