Some refactoring. Also added more customization features.
Added licensing.