Splited code into different modules and added session code