This has been fixed now just using the parameters and removed the duplicate code.