Removed some redundant code and made the example prettiery