working --but can still be improved