Final code cleanup and added license info