cleaned up code and ripped out un-needed algorithms 1 and 2