general cleanup of functions and variables, updated todo