cleaned up and functional again