CHANGED:cleaned up the code