alain's ui improvement and further code cleanup