add functions and fix problems again