Fixed improved the function definition stuff

Also fixed a bug in ternaries with true/false