Deleted duplicates, cleaned up code