Several improvements, need to test