using new api and minor style changes