updated code slightly and up'ed version