added orientations and fixed the bad code