fixed #16
implemented #3
some warnings removed