Simplified and changed some things around.