WIP: handmade js equivalent