Better implementation of capped