fixed size logic and added tests