returns errors
better code in refformat