Solves #6.
improvements for #7.