Issue 8 & 9 and a few fixes