added license information; broke up main into other files