major changes to make this work