Renamed classes and added generality