Changed import statements to make it behave correctly when used as a library.