fix #41 by removing special case
Also, clean up some code.