defining methods in the contoller