Removed duplicating code & fixed redirect