implemented james' suggestions