Cleaned up code further, added some code

Currently doesn't work however most of the code is there for the basic
intended feature set.