following the coding of JGallardo (and will mess around with it myself)