added new parameter for optimal figure size