demo version with minor fixes