get EOF working, tidy
add specs, fix some encoding issues