I should just write this shit in ruby