Final code cleanup. Minor bug fixed. Added MIT License.