Cap

Cap function completed