Migrated code from main fog gem