Various improvments. I really should be committing more often