Simplifying some of the code