Reworked some code

-Changed some backend code to be more neat