fixes #14 and improves code minorly