fixes #17, fixes #15 and finally #16 almost done