changed a lot......needs serious merging