more corrections to code and functionality