more refactoring and testing of web-frontend