Few bits of code that will hopefully make my life easier