Implemented first version of kpe.