Code tweaks
Dead code
Add some tests