Streamlined some code