added reset layout binding and cleaned code