[WIP] continue #52 and #93

This PR is to continue #52 and #93.

As I don't see exactly what is missing please comment it and I will continue the job.