horrible wip - legalize function params