Simplified compatiblity code + added some javadocs.