Optional parameters fixed.
Basic refactor.