Refactored, cleaned and commented the code

Still needs a query parser and some sort of GUI