hacked out backend functionality similar to what php scripts did. lots of bugs but works for now.