added more functionality, updated example