changed a lot of functions and layout of the template