Fixed edit page of category and cleaned up code