changed a few things, removed some redundant code