Started packing the code into a class for better organization.