this is a mess but its kinda working