initial commit, extracted code from bonaparte-java