added scratch functionality
added scratch_length
some bug fixes. worked on test