code cleanup and adding licence files