Second Commit with working code

The two required functions have been tested and are working.