Added javadoc and made some minor modifications to the return values