renaming and simplifying some code