partial implementation of issue #1, committing before potentially dangerous changes