[DO NOT MERGE] Improve custom scope creation