changed sid to id and cleaned up