almost done implementation of JPS