Resubmitting #18 to dev branch