bug fixes, moving common clustering vars to separate class