added Left and Right size optimisation but there exists a bug