#376: some fixes
#376: updated logic, UI
#376: refactoring according to Alexander's comments
#376: added specs