0703 update - final

final version. All functions are realized, but still - main function is
too big, not seperated it into detailed functions.