implemented most basic version of last method