Vectorized main and depadded. Need to debug.