cleaning up code further