convert to functions
WIP