Refactored Variable names
Change some small things,
Tested to some extent