improvement. readme, restructure

add read me. divide main function into separate functions