added attaching function