refactored/fixed lots of code 
added LICENSE