Simplify some code as a function is not required anymore