fixed joshs code