use static_cast in place of c-style cast (code review feedback)
put all commented code in if(false) blocks instead; fix ensuing broken code