bashart function improved