clean up, improve performance

checked #33