Creating function and fixing a few errors