fill in most functions, add TODOs for rest