worked out the many bugs