separated main into various c/h files