Updated code for custom width & height