device firmware cleaned up, and functional interface improved. more comments