Implemented most of Function