Code refactoring + UI behaviour