Implementing new method [] and some minor refactorings