hopefully better code