small improvements and some macro added