nearpy copy from pixelogik