mainly works, tehre are a few bugs