Code is much better now