messy and cleaner approach, both works
done