adding logic and ui enhancements