Added support for back button and clean code