wrapping everything in a function