Cleaned up code and added license :D