Moved some imports inside methods where they are used, to reduce required dependencies