todo based on Tommi's hack.