Handled basic errors in WebUI
Made code more consistent.