mostly works clumsily
transitioning to better code