Made better readable, removed some unnecessary code