fold into a single class
bug fixes after folding into a single class