Removed UI error messages and optimized code