rough version of RPI project part2