major bug fix: brought to working condition