fixes issue #6. removed some unused code