updated methods. Contains many unresolved issues.