cleaned up code. everything seems to be working...