Fix bug #58, clean up some uneeded code