optimization, type is more restrictive than side (about 5% faster :D )