Move related functions closer together