Clean up and use inheritance to save code