WebApp - Refactored and added unit tests