base optimization

@taviscaron please review
base optimization