extended functionality, revised code