Added issue 4, some minor fixes