Implemented cursor class, removed query aliasing