cleaning up code by using self