building last method functionality