fixing up function calls so that they are more modular
got function calls working well and tested them with record types