removing unnecessary functions, fixing attachment bug