Removed using of deprecthed functions.
Fixed issue #11.
Removed unsued variables.