Added more comments and reworked the code a bit to be more efficient and clean. Also considering moving the 'access' control into it's own module.. will have to talk to tamm first tho so she's aware that the move is done so the front-end can adjust accordingly