cleaned up code step2