I coded along with emma's version and will append this with my own version