Some functions in the wrong place