cleaned up method a bit.