Add license and code cleanup