solved the optional exercise