implemented three different ways of doing it