Style cleanup and error handling
Add license agreement