ticket:4 add main functionality, fix mistakes