Second Commit

Added all necessary functionality. In the process of refining the code
to be as clean and non-repetitive as possible.