Cleaning up/simplifying code