Optimized validation + improved return of httpstatuscodes