Modified some code according to Bens wishes