Minfixes, clean code, closes #4