Migrated part of code from querygenelist.php to genelist.php