Updated to be more flewible