added javadoc, fixed nasty pow bug