Slight refactor of last_layer code
Remove puts statements
Move let calls up a level
Add test for write() method