refactor, improve tests, add menu items