cleaned up code for consitency