Smart completion optimization
More efficient code completion + fixed a few bugs