Added reset of the marker state, other minor cleanup.