slight restructure and call ruby directly