Closes #3 + minor improvments